home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / fax / src / libtiff / tif_print.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  17KB  |  564 lines

  1. #ifndef lint
  2. static char rcsid[] = "$Header: /usr/people/sam/tiff/libtiff/RCS/tif_print.c,v 1.46 92/10/21 13:42:17 sam Rel $";
  3. #endif
  4.  
  5. /*
  6.  * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler
  7.  * Copyright (c) 1991, 1992 Silicon Graphics, Inc.
  8.  *
  9.  * Permission to use, copy, modify, distribute, and sell this software and 
  10.  * its documentation for any purpose is hereby granted without fee, provided
  11.  * that (i) the above copyright notices and this permission notice appear in
  12.  * all copies of the software and related documentation, and (ii) the names of
  13.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  14.  * publicity relating to the software without the specific, prior written
  15.  * permission of Sam Leffler and Silicon Graphics.
  16.  * 
  17.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  18.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  19.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  20.  * 
  21.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  22.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  23.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  24.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  25.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  26.  * OF THIS SOFTWARE.
  27.  */
  28.  
  29. /*
  30.  * TIFF Library.
  31.  *
  32.  * Directory Printing Support
  33.  */
  34. #include "tiffiop.h"
  35. #include <stdio.h>
  36.  
  37. #ifdef JPEG_SUPPORT
  38. static
  39. DECLARE2(JPEGPrintQTable, FILE*, fd, u_char*, tab)
  40. {
  41.     int i, j;
  42.     char *sep;
  43.  
  44.     fputc('\n', fd);
  45.     for (i = 0; i < 8; i++) {
  46.         sep = "    ";
  47.         for (j = 0; j < 8; j++) {
  48.             fprintf(fd, "%s%2u", sep, tab[8*i+j]);
  49.             sep = ", ";
  50.         }
  51.         fputc('\n', fd);
  52.     }
  53. }
  54.  
  55. static
  56. DECLARE2(JPEGPrintCTable, FILE*, fd, u_char*, tab)
  57. {
  58.     int i, n, count;
  59.     char *sep;
  60.  
  61.     fprintf(fd, "\n    Bits:");
  62.     count = 0;
  63.     for (i = 0; i < 16; i++) {
  64.         fprintf(fd, " %u", tab[i]);
  65.         count += tab[i];
  66.     }
  67.     n = 0;
  68.     for (; count > 0; count--) {
  69.         if ((n % 8) == 0) {
  70.             fputc('\n', fd);
  71.             sep = "    ";
  72.         }
  73.         fprintf(fd, "%s0x%02x", sep, tab[i++]);
  74.         sep = ", ";
  75.         n++;
  76.  
  77.     }
  78.     if (n % 8)
  79.         fputc('\n', fd);
  80. }
  81. #endif
  82.  
  83. static const char *photoNames[] = {
  84.     "min-is-white",                /* PHOTOMETRIC_MINISWHITE */
  85.     "min-is-black",                /* PHOTOMETRIC_MINISBLACK */
  86.     "RGB color",                /* PHOTOMETRIC_RGB */
  87.     "palette color (RGB from colormap)",    /* PHOTOMETRIC_PALETTE */
  88.     "transparency mask",            /* PHOTOMETRIC_MASK */
  89.     "separated",                /* PHOTOMETRIC_SEPARATED */
  90.     "YCbCr",                    /* PHOTOMETRIC_YCBCR */
  91.     "7 (0x7)",
  92.     "CIE L*a*b*",                /* PHOTOMETRIC_CIELAB */
  93. };
  94. #define    NPHOTONAMES    (sizeof (photoNames) / sizeof (photoNames[0]))
  95.  
  96. static const char *orientNames[] = {
  97.     "0 (0x0)",
  98.     "row 0 top, col 0 lhs",            /* ORIENTATION_TOPLEFT */
  99.     "row 0 top, col 0 rhs",            /* ORIENTATION_TOPRIGHT */
  100.     "row 0 bottom, col 0 rhs",            /* ORIENTATION_BOTRIGHT */
  101.     "row 0 bottom, col 0 lhs",            /* ORIENTATION_BOTLEFT */
  102.     "row 0 lhs, col 0 top",            /* ORIENTATION_LEFTTOP */
  103.     "row 0 rhs, col 0 top",            /* ORIENTATION_RIGHTTOP */
  104.     "row 0 rhs, col 0 bottom",            /* ORIENTATION_RIGHTBOT */
  105.     "row 0 lhs, col 0 bottom",            /* ORIENTATION_LEFTBOT */
  106. };
  107. #define    NORIENTNAMES    (sizeof (orientNames) / sizeof (orientNames[0]))
  108.  
  109. /*
  110.  * Print the contents of the current directory
  111.  * to the specified stdio file stream.
  112.  */
  113. void
  114. DECLARE3(TIFFPrintDirectory, TIFF*, tif, FILE*, fd, long, flags)
  115. {
  116.     register TIFFDirectory *td;
  117.     char *sep;
  118.     int i, j;
  119.     long n;
  120.  
  121.     fprintf(fd, "TIFF Directory at offset 0x%x\n", tif->tif_diroff);
  122.     td = &tif->tif_dir;
  123.     if (TIFFFieldSet(tif,FIELD_SUBFILETYPE)) {
  124.         fprintf(fd, "  Subfile Type:");
  125.         sep = " ";
  126.         if (td->td_subfiletype & FILETYPE_REDUCEDIMAGE) {
  127.             fprintf(fd, "%sreduced-resolution image", sep);
  128.             sep = "/";
  129.         }
  130.         if (td->td_subfiletype & FILETYPE_PAGE) {
  131.             fprintf(fd, "%smulti-page document", sep);
  132.             sep = "/";
  133.         }
  134.         if (td->td_subfiletype & FILETYPE_MASK)
  135.             fprintf(fd, "%stransparency mask", sep);
  136.         fprintf(fd, " (%u = 0x%x)\n",
  137.             td->td_subfiletype, td->td_subfiletype);
  138.     }
  139.     if (TIFFFieldSet(tif,FIELD_IMAGEDIMENSIONS)) {
  140.         fprintf(fd, "  Image Width: %lu Image Length: %lu",
  141.             td->td_imagewidth, td->td_imagelength);
  142.         if (TIFFFieldSet(tif,FIELD_IMAGEDEPTH))
  143.             fprintf(fd, " Image Depth: %lu", td->td_imagedepth);
  144.         fprintf(fd, "\n");
  145.     }
  146.     if (TIFFFieldSet(tif,FIELD_TILEDIMENSIONS)) {
  147.         fprintf(fd, "  Tile Width: %lu Tile Length: %lu",
  148.             td->td_tilewidth, td->td_tilelength);
  149.         if (TIFFFieldSet(tif,FIELD_TILEDEPTH))
  150.             fprintf(fd, " Tile Depth: %lu", td->td_tiledepth);
  151.         fprintf(fd, "\n");
  152.     }
  153.     if (TIFFFieldSet(tif,FIELD_RESOLUTION)) {
  154.         fprintf(fd, "  Resolution: %g, %g",
  155.             td->td_xresolution, td->td_yresolution);
  156.         if (TIFFFieldSet(tif,FIELD_RESOLUTIONUNIT)) {
  157.             switch (td->td_resolutionunit) {
  158.             case RESUNIT_NONE:
  159.                 fprintf(fd, " (unitless)");
  160.                 break;
  161.             case RESUNIT_INCH:
  162.                 fprintf(fd, " pixels/inch");
  163.                 break;
  164.             case RESUNIT_CENTIMETER:
  165.                 fprintf(fd, " pixels/cm");
  166.                 break;
  167.             default:
  168.                 fprintf(fd, " (unit %u = 0x%x)",
  169.                     td->td_resolutionunit,
  170.                     td->td_resolutionunit);
  171.                 break;
  172.             }
  173.         }
  174.         fprintf(fd, "\n");
  175.     }
  176.     if (TIFFFieldSet(tif,FIELD_POSITION))
  177.         fprintf(fd, "  Position: %g, %g\n",
  178.             td->td_xposition, td->td_yposition);
  179.     if (TIFFFieldSet(tif,FIELD_BITSPERSAMPLE))
  180.         fprintf(fd, "  Bits/Sample: %u\n", td->td_bitspersample);
  181.     if (TIFFFieldSet(tif,FIELD_SAMPLEFORMAT)) {
  182.         fprintf(fd, "  Sample Format: ");
  183.         switch (td->td_sampleformat) {
  184.         case SAMPLEFORMAT_VOID:
  185.             fprintf(fd, "void\n");
  186.             break;
  187.         case SAMPLEFORMAT_INT:
  188.             fprintf(fd, "signed integer\n");
  189.             break;
  190.         case SAMPLEFORMAT_UINT:
  191.             fprintf(fd, "unsigned integer\n");
  192.             break;
  193.         case SAMPLEFORMAT_IEEEFP:
  194.             fprintf(fd, "IEEE floating point\n");
  195.             break;
  196.         default:
  197.             fprintf(fd, "%u (0x%x)\n",
  198.                 td->td_sampleformat, td->td_sampleformat);
  199.             break;
  200.         }
  201.     }
  202.     if (TIFFFieldSet(tif,FIELD_COMPRESSION)) {
  203.         fprintf(fd, "  Compression Scheme: ");
  204.         switch (td->td_compression) {
  205.         case COMPRESSION_NONE:
  206.             fprintf(fd, "none\n");
  207.             break;
  208.         case COMPRESSION_CCITTRLE:
  209.             fprintf(fd, "CCITT modified Huffman encoding\n");
  210.             break;
  211.         case COMPRESSION_CCITTFAX3:
  212.             fprintf(fd, "CCITT Group 3 facsimile encoding\n");
  213.             break;
  214.         case COMPRESSION_CCITTFAX4:
  215.             fprintf(fd, "CCITT Group 4 facsimile encoding\n");
  216.             break;
  217.         case COMPRESSION_CCITTRLEW:
  218.             fprintf(fd, "CCITT modified Huffman encoding %s\n",
  219.                 "w/ word alignment");
  220.             break;
  221.         case COMPRESSION_PACKBITS:
  222.             fprintf(fd, "Macintosh PackBits encoding\n");
  223.             break;
  224.         case COMPRESSION_THUNDERSCAN:
  225.             fprintf(fd, "ThunderScan 4-bit encoding\n");
  226.             break;
  227.         case COMPRESSION_LZW:
  228.             fprintf(fd, "Lempel-Ziv & Welch encoding\n");
  229.             break;
  230.         case COMPRESSION_NEXT:
  231.             fprintf(fd, "NeXT 2-bit encoding\n");
  232.             break;
  233.         case COMPRESSION_JPEG:
  234.             fprintf(fd, "JPEG encoding\n");
  235.             break;
  236.         default:
  237.             fprintf(fd, "%u (0x%x)\n",
  238.                 td->td_compression, td->td_compression);
  239.             break;
  240.         }
  241.     }
  242.     if (TIFFFieldSet(tif,FIELD_PHOTOMETRIC)) {
  243.         fprintf(fd, "  Photometric Interpretation: ");
  244.         if (td->td_photometric < NPHOTONAMES)
  245.             fprintf(fd, "%s\n", photoNames[td->td_photometric]);
  246.         else
  247.             fprintf(fd, "%u (0x%x)\n",
  248.                 td->td_photometric, td->td_photometric);
  249.     }
  250.     if (TIFFFieldSet(tif,FIELD_MATTEING))
  251.         fprintf(fd, "  Matteing: %s\n", td->td_matteing ?
  252.             "pre-multiplied with alpha channel" : "none");
  253. #ifdef CMYK_SUPPORT
  254.     if (TIFFFieldSet(tif,FIELD_INKSET)) {
  255.         fprintf(fd, "  Ink Set: ");
  256.         switch (td->td_inkset) {
  257.         case INKSET_CMYK:
  258.             fprintf(fd, "CMYK\n");
  259.             break;
  260.         default:
  261.             fprintf(fd, "%u (0x%x)\n",
  262.                 td->td_inkset, td->td_inkset);
  263.             break;
  264.         }
  265.     }
  266.     if (TIFFFieldSet(tif,FIELD_INKNAMES)) {
  267.         char *cp;
  268.         fprintf(fd, "  Ink Names: ");
  269.         i = td->td_samplesperpixel;
  270.         sep = "";
  271.         for (cp = td->td_inknames; i > 0; cp = strchr(cp, '\0')) {
  272.             fprintf(fd, "%s%s", sep, cp);
  273.             sep = ", ";
  274.         }
  275.     }
  276.     if (TIFFFieldSet(tif,FIELD_DOTRANGE))
  277.         fprintf(fd, "  Dot Range: %u-%u\n",
  278.             td->td_dotrange[0], td->td_dotrange[1]);
  279.     if (TIFFFieldSet(tif,FIELD_TARGETPRINTER))
  280.         fprintf(fd, "  Target Printer: %s\n", td->td_targetprinter);
  281. #endif
  282.     if (TIFFFieldSet(tif,FIELD_THRESHHOLDING)) {
  283.         fprintf(fd, "  Thresholding: ");
  284.         switch (td->td_threshholding) {
  285.         case THRESHHOLD_BILEVEL:
  286.             fprintf(fd, "bilevel art scan\n");
  287.             break;
  288.         case THRESHHOLD_HALFTONE:
  289.             fprintf(fd, "halftone or dithered scan\n");
  290.             break;
  291.         case THRESHHOLD_ERRORDIFFUSE:
  292.             fprintf(fd, "error diffused\n");
  293.             break;
  294.         default:
  295.             fprintf(fd, "%u (0x%x)\n",
  296.                 td->td_threshholding, td->td_threshholding);
  297.             break;
  298.         }
  299.     }
  300.     if (TIFFFieldSet(tif,FIELD_FILLORDER)) {
  301.         fprintf(fd, "  FillOrder: ");
  302.         switch (td->td_fillorder) {
  303.         case FILLORDER_MSB2LSB:
  304.             fprintf(fd, "msb-to-lsb\n");
  305.             break;
  306.         case FILLORDER_LSB2MSB:
  307.             fprintf(fd, "lsb-to-msb\n");
  308.             break;
  309.         default:
  310.             fprintf(fd, "%u (0x%x)\n",
  311.                 td->td_fillorder, td->td_fillorder);
  312.             break;
  313.         }
  314.     }
  315.     if (TIFFFieldSet(tif,FIELD_PREDICTOR)) {
  316.         fprintf(fd, "  Predictor: ");
  317.         switch (td->td_predictor) {
  318.         case 1:
  319.             fprintf(fd, "none\n");
  320.             break;
  321.         case 2:
  322.             fprintf(fd, "horizontal differencing\n");
  323.             break;
  324.         default:
  325.             fprintf(fd, "%u (0x%x)\n",
  326.                 td->td_predictor, td->td_predictor);
  327.             break;
  328.         }
  329.     }
  330. #ifdef YCBCR_SUPPORT
  331.     if (TIFFFieldSet(tif,FIELD_YCBCRSUBSAMPLING))
  332.         fprintf(fd, "  YCbCr Subsampling: %u, %u\n",
  333.             td->td_ycbcrsubsampling[0], td->td_ycbcrsubsampling[1]);
  334.     if (TIFFFieldSet(tif,FIELD_YCBCRPOSITIONING)) {
  335.         fprintf(fd, "  YCbCr Positioning: ");
  336.         switch (td->td_ycbcrpositioning) {
  337.         case YCBCRPOSITION_CENTERED:
  338.             fprintf(fd, "centered\n");
  339.             break;
  340.         case YCBCRPOSITION_COSITED:
  341.             fprintf(fd, "cosited\n");
  342.             break;
  343.         default:
  344.             fprintf(fd, "%u (0x%x)\n",
  345.                 td->td_ycbcrpositioning, td->td_ycbcrpositioning);
  346.             break;
  347.         }
  348.     }
  349.     if (TIFFFieldSet(tif,FIELD_YCBCRCOEFFICIENTS))
  350.         fprintf(fd, "  YCbCr Coefficients: %g, %g, %g\n",
  351.             td->td_ycbcrcoeffs[0],
  352.             td->td_ycbcrcoeffs[1],
  353.             td->td_ycbcrcoeffs[2]);
  354. #endif
  355. #ifdef JPEG_SUPPORT
  356.     if (TIFFFieldSet(tif,FIELD_JPEGPROC)) {
  357.         fprintf(fd, "  JPEG Processing Mode: ");
  358.         switch (td->td_jpegproc) {
  359.         case JPEGPROC_BASELINE:
  360.             fprintf(fd, "baseline sequential algorithm\n");
  361.             break;
  362.         case JPEGPROC_LOSSLESS:
  363.             fprintf(fd, "lossless algorithm with Huffman coding\n");
  364.             break;
  365.         default:
  366.             fprintf(fd, "%u (0x%x)\n",
  367.                 td->td_jpegproc, td->td_jpegproc);
  368.             break;
  369.         }
  370.     }
  371.     if (TIFFFieldSet(tif,FIELD_JPEGRESTARTINTERVAL)) {
  372.         fprintf(fd, "  JPEG Restart Interval: ");
  373.         if (td->td_jpegrestartinterval)
  374.             fprintf(fd, "%u\n", td->td_jpegrestartinterval);
  375.         else
  376.             fprintf(fd, "(no restart markers)\n");
  377.     }
  378.     if (TIFFFieldSet(tif,FIELD_JPEGQTABLES)) {
  379.         fprintf(fd, "  JPEG Quantization Tables: ");
  380.         if (flags & TIFFPRINT_JPEGQTABLES) {
  381.             for (i = 0; i < td->td_samplesperpixel; i++)
  382.                 JPEGPrintQTable(fd, td->td_qtab[i]);
  383.         } else
  384.             fprintf(fd, "(present)\n");
  385.     }
  386.     if (TIFFFieldSet(tif,FIELD_JPEGDCTABLES)) {
  387.         fprintf(fd, "  JPEG DC Tables: ");
  388.         if (flags & TIFFPRINT_JPEGDCTABLES) {
  389.             for (i = 0; i < td->td_samplesperpixel; i++)
  390.                 JPEGPrintCTable(fd, td->td_dctab[i]);
  391.         } else
  392.             fprintf(fd, "(present)\n");
  393.     }
  394.     if (TIFFFieldSet(tif,FIELD_JPEGACTABLES)) {
  395.         fprintf(fd, "  JPEG AC Tables: ");
  396.         if (flags & TIFFPRINT_JPEGACTABLES) {
  397.             for (i = 0; i < td->td_samplesperpixel; i++)
  398.                 JPEGPrintCTable(fd, td->td_actab[i]);
  399.         } else
  400.             fprintf(fd, "(present)\n");
  401.     }
  402. #endif
  403.     if (TIFFFieldSet(tif,FIELD_HALFTONEHINTS))
  404.         fprintf(fd, "  Halftone Hints: light %u dark %u\n",
  405.             td->td_halftonehints[0], td->td_halftonehints[1]);
  406.     if (TIFFFieldSet(tif,FIELD_ARTIST))
  407.         fprintf(fd, "  Artist: \"%s\"\n", td->td_artist);
  408.     if (TIFFFieldSet(tif,FIELD_DATETIME))
  409.         fprintf(fd, "  Date & Time: \"%s\"\n", td->td_datetime);
  410.     if (TIFFFieldSet(tif,FIELD_HOSTCOMPUTER))
  411.         fprintf(fd, "  Host Computer: \"%s\"\n", td->td_hostcomputer);
  412.     if (TIFFFieldSet(tif,FIELD_SOFTWARE))
  413.         fprintf(fd, "  Software: \"%s\"\n", td->td_software);
  414.     if (TIFFFieldSet(tif,FIELD_DOCUMENTNAME))
  415.         fprintf(fd, "  Document Name: \"%s\"\n", td->td_documentname);
  416.     if (TIFFFieldSet(tif,FIELD_IMAGEDESCRIPTION))
  417.         fprintf(fd, "  Image Description: \"%s\"\n",
  418.             td->td_imagedescription);
  419.     if (TIFFFieldSet(tif,FIELD_MAKE))
  420.         fprintf(fd, "  Make: \"%s\"\n", td->td_make);
  421.     if (TIFFFieldSet(tif,FIELD_MODEL))
  422.         fprintf(fd, "  Model: \"%s\"\n", td->td_model);
  423.     if (TIFFFieldSet(tif,FIELD_ORIENTATION)) {
  424.         fprintf(fd, "  Orientation: ");
  425.         if (td->td_orientation < NORIENTNAMES)
  426.             fprintf(fd, "%s\n", orientNames[td->td_orientation]);
  427.         else
  428.             fprintf(fd, "%u (0x%x)\n",
  429.                 td->td_orientation, td->td_orientation);
  430.     }
  431.     if (TIFFFieldSet(tif,FIELD_SAMPLESPERPIXEL))
  432.         fprintf(fd, "  Samples/Pixel: %u\n", td->td_samplesperpixel);
  433.     if (TIFFFieldSet(tif,FIELD_ROWSPERSTRIP)) {
  434.         fprintf(fd, "  Rows/Strip: ");
  435.         if (td->td_rowsperstrip == 0xffffffffL)
  436.             fprintf(fd, "(infinite)\n");
  437.         else
  438.             fprintf(fd, "%u\n", td->td_rowsperstrip);
  439.     }
  440.     if (TIFFFieldSet(tif,FIELD_MINSAMPLEVALUE))
  441.         fprintf(fd, "  Min Sample Value: %u\n", td->td_minsamplevalue);
  442.     if (TIFFFieldSet(tif,FIELD_MAXSAMPLEVALUE))
  443.         fprintf(fd, "  Max Sample Value: %u\n", td->td_maxsamplevalue);
  444.     if (TIFFFieldSet(tif,FIELD_PLANARCONFIG)) {
  445.         fprintf(fd, "  Planar Configuration: ");
  446.         switch (td->td_planarconfig) {
  447.         case PLANARCONFIG_CONTIG:
  448.             fprintf(fd, "single image plane\n");
  449.             break;
  450.         case PLANARCONFIG_SEPARATE:
  451.             fprintf(fd, "separate image planes\n");
  452.             break;
  453.         default:
  454.             fprintf(fd, "%u (0x%x)\n",
  455.                 td->td_planarconfig, td->td_planarconfig);
  456.             break;
  457.         }
  458.     }
  459.     if (TIFFFieldSet(tif,FIELD_PAGENAME))
  460.         fprintf(fd, "  Page Name: \"%s\"\n", td->td_pagename);
  461.     if (TIFFFieldSet(tif,FIELD_GROUP3OPTIONS)) {
  462.         fprintf(fd, "  Group 3 Options:");
  463.         sep = " ";
  464.         if (td->td_group3options & GROUP3OPT_2DENCODING)
  465.             fprintf(fd, "%s2-d encoding", sep), sep = "+";
  466.         if (td->td_group3options & GROUP3OPT_FILLBITS)
  467.             fprintf(fd, "%sEOL padding", sep), sep = "+";
  468.         if (td->td_group3options & GROUP3OPT_UNCOMPRESSED)
  469.             fprintf(fd, "%suncompressed data", sep);
  470.         fprintf(fd, " (%u = 0x%x)\n",
  471.             td->td_group3options, td->td_group3options);
  472.     }
  473.     if (TIFFFieldSet(tif,FIELD_CLEANFAXDATA)) {
  474.         fprintf(fd, "  Fax Data: ");
  475.         switch (td->td_cleanfaxdata) {
  476.         case CLEANFAXDATA_CLEAN:
  477.             fprintf(fd, "clean\n");
  478.             break;
  479.         case CLEANFAXDATA_REGENERATED:
  480.             fprintf(fd, "receiver regenerated\n");
  481.             break;
  482.         case CLEANFAXDATA_UNCLEAN:
  483.             fprintf(fd, "uncorrected errors\n");
  484.             break;
  485.         default:
  486.             fprintf(fd, "(%u = 0x%x)\n",
  487.                 td->td_cleanfaxdata, td->td_cleanfaxdata);
  488.             break;
  489.         }
  490.     }
  491.     if (TIFFFieldSet(tif,FIELD_BADFAXLINES))
  492.         fprintf(fd, "  Bad Fax Lines: %u\n", td->td_badfaxlines);
  493.     if (TIFFFieldSet(tif,FIELD_BADFAXRUN))
  494.         fprintf(fd, "  Consecutive Bad Fax Lines: %u\n",
  495.             td->td_badfaxrun);
  496.     if (TIFFFieldSet(tif,FIELD_GROUP4OPTIONS)) {
  497.         fprintf(fd, "  Group 4 Options:");
  498.         if (td->td_group4options & GROUP4OPT_UNCOMPRESSED)
  499.             fprintf(fd, "uncompressed data");
  500.         fprintf(fd, " (%u = 0x%x)\n",
  501.             td->td_group4options, td->td_group4options);
  502.     }
  503.     if (TIFFFieldSet(tif,FIELD_PAGENUMBER))
  504.         fprintf(fd, "  Page Number: %u-%u\n",
  505.             td->td_pagenumber[0], td->td_pagenumber[1]);
  506.     if (TIFFFieldSet(tif,FIELD_COLORMAP)) {
  507.         fprintf(fd, "  Color Map: ");
  508.         if (flags & TIFFPRINT_COLORMAP) {
  509.             fprintf(fd, "\n");
  510.             n = 1L<<td->td_bitspersample;
  511.             for (i = 0; i < n; i++)
  512.                 fprintf(fd, "   %5d: %5u %5u %5u\n",
  513.                     i,
  514.                     td->td_colormap[0][i],
  515.                     td->td_colormap[1][i],
  516.                     td->td_colormap[2][i]);
  517.         } else
  518.             fprintf(fd, "(present)\n");
  519.     }
  520. #ifdef COLORIMETRY_SUPPORT
  521.     if (TIFFFieldSet(tif,FIELD_WHITEPOINT))
  522.         fprintf(fd, "  White Point: %g-%g\n",
  523.             td->td_whitepoint[0], td->td_whitepoint[1]);
  524.     if (TIFFFieldSet(tif,FIELD_PRIMARYCHROMAS))
  525.         fprintf(fd, "  Primary Chromaticities: %g,%g %g,%g %g,%g\n",
  526.             td->td_primarychromas[0], td->td_primarychromas[1],
  527.             td->td_primarychromas[2], td->td_primarychromas[3],
  528.             td->td_primarychromas[4], td->td_primarychromas[5]);
  529.     if (TIFFFieldSet(tif,FIELD_REFBLACKWHITE)) {
  530.         fprintf(fd, "  Reference Black/White:\n");
  531.         for (i = 0; i < td->td_samplesperpixel; i++)
  532.             fprintf(fd, "    %2d: %5g %5g\n",
  533.                 i,
  534.                 td->td_refblackwhite[2*i+0],
  535.                 td->td_refblackwhite[2*i+1]);
  536.     }
  537.     if (TIFFFieldSet(tif,FIELD_TRANSFERFUNCTION)) {
  538.         fprintf(fd, "  Transfer Function: ");
  539.         if (flags & TIFFPRINT_CURVES) {
  540.             fprintf(fd, "\n");
  541.             n = 1L<<td->td_bitspersample;
  542.             for (i = 0; i < n; i++) {
  543.                 fprintf(fd, "    %2d: %5u",
  544.                     i, td->td_transferfunction[0][i]);
  545.                 for (j = 1; j < td->td_samplesperpixel; j++)
  546.                     fprintf(fd, " %5u",
  547.                         td->td_transferfunction[j][i]);
  548.                 putc('\n', fd);
  549.             }
  550.         } else
  551.             fprintf(fd, "(present)\n");
  552.     }
  553. #endif
  554.     if ((flags & TIFFPRINT_STRIPS) &&
  555.         TIFFFieldSet(tif,FIELD_STRIPOFFSETS)) {
  556.         fprintf(fd, "  %u %s:\n",
  557.             td->td_nstrips,
  558.             isTiled(tif) ? "Tiles" : "Strips");
  559.         for (i = 0; i < td->td_nstrips; i++)
  560.             fprintf(fd, "    %3d: [%8u, %8u]\n",
  561.                 i, td->td_stripoffset[i], td->td_stripbytecount[i]);
  562.     }
  563. }
  564.